﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FutureOpen.Web.Pages;
using FutureOpen.Core;
using FutureOpen.Core.func;
using FutureOpen.Core.func.db;


public partial class MyTagsManagement : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        base.PageInit();
        if (!IsPostBack)
        {  
            if (!this.IsLogin()) SimulateLogin();
            int uid = this.MyUsr;
            ViewState["uid"] = uid;
            MyTagJob mtj = new MyTagJob(uid);            
            try
            {
                this.GridView1.DataSource = mtj.GetUsrTags();
                this.GridView1.DataBind();
            }
            catch { }
        }

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        int uid = (int) ViewState["uid"];
        MyTagJob mtj = new MyTagJob(uid);
        mtj.AddTag(this.TextBox1.Text);
        Page.Response.Redirect("MyTagsManagement.aspx");
    }

    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int uid = (int)ViewState["uid"];
        
        string tag = GridView1.DataKeys[e.RowIndex].Value.ToString();
        
        Page.Response.Redirect("MyTagsManagement.aspx");
    }
}
